﻿@page
@{ Layout = "_Layout"; }

<el-row :gutter="0">
    <el-col :span="6">
        @await Html.PartialAsync("_PartialTree")
    </el-col>
    <el-col :span="18">
        <el-card shadow="never" style="border-radius:0;">
            <el-form v-on:submit.native.prevent :inline="true" :size="euiSize">
                <el-form-item label="题目">
                    <el-input v-model="formInline.keyword" placeholder="关键字" prefix-icon="el-icon-search" clearable></el-input>
                </el-form-item>
                <el-form-item label="">
                    <el-select v-model="formInline.txId" placeholder="按题型" v-on:change="btnSearchClick" clearable>
                        <el-option v-for="tx in txList"
                                   :key="tx.id"
                                   :label="tx.name"
                                   :value="tx.id">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="">
                    <el-select style="width:100px;" v-model="formInline.nandu" placeholder="按难度" v-on:change="btnSearchClick" clearable>
                        <el-option v-for="nd in 5"
                                   :key="nd"
                                   :value="nd">
                            {{ nd }}<i class="el-icon-star-on" style="color:#FF9900;margin-left:3px;font-size:14px;"></i>
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="">
                    <el-select style="width:100px;" v-model="formInline.isStop" placeholder="按状态" v-on:change="btnSearchClick" clearable>
                        <el-option label="启用" value="false"></el-option>
                        <el-option label="停用" value="true"></el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="">
                    <el-select style="width:100px;" v-model="formInline.order" placeholder="排序" v-on:change="btnSearchClick" clearable>
                        <el-option label="难度" value="nandu"></el-option>
                        <el-option label="分数" value="score"></el-option>
                        <el-option label="题型" value="tx"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="">
                    <el-select v-model="formInline.tmGroupId" placeholder="题目组" v-on:change="btnSearchClick" clearable>
                        <el-option v-for="group in tmGroups"
                                   :key="group.id"
                                   :label="group.groupName"
                                   :value="group.id">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <el-button icon="el-icon-search" type="primary" v-on:click="btnSearchClick">查 询</el-button>
                    <el-button plain icon="el-icon-plus" type="primary" v-on:click="btnEditClick()">新 增</el-button>
                    <el-dropdown :show-timeout="0" placement="bottom" style="margin-left:10px;">
                        <el-button :size="euiSize" v-on:click.stop="return false">
                            更多操作<i class="el-icon-arrow-down el-icon--down"></i>
                        </el-button>
                        <el-dropdown-menu slot="dropdown">
                            <el-dropdown-item icon="el-icon-upload" v-on:click.native="handleCommand('importExcel')">excel导入</el-dropdown-item>
                            <el-dropdown-item icon="el-icon-download" v-on:click.native="handleCommand('exportExcel')">excel导出</el-dropdown-item>
                            <el-dropdown-item icon="el-icon-plus" v-on:click.native="btnWordAddClick">批量新增</el-dropdown-item>
                            <el-dropdown-item icon="el-icon-delete" v-on:click.native="handleCommand('deletes')" style="color:red;">批量删除</el-dropdown-item>
                        </el-dropdown-menu>
                    </el-dropdown>
                </el-form-item>
                <el-form-item>
                </el-form-item>
            </el-form>
            <el-table ref="tmTable" :data="tmList" :size="euiSize"
                      style="width: 100%" :height="$(window).height()-211">
                <el-table-column type="selection" align="left"
                                 width="28">
                </el-table-column>
                <el-table-column label="#"
                                 type="index"
                                 width="60"
                                 align="left">
                    <template scope="scope">
                        <span>{{(formInline.pageIndex - 1) * formInline.pageSize + scope.$index + 1}}</span>
                    </template>
                </el-table-column>
                <el-table-column show-overflow-tooltip prop="title" label="题目">
                    <template slot-scope="scope">
                        <el-link type="primary" :underline="false" v-on:click="handleCommand('info',scope.row)">
                            <span v-html="scope.row.title" style="color:red;" v-if="scope.row.locked"></span>
                            <span v-html="scope.row.title" v-else></span>
                        </el-link>
                    </template>
                </el-table-column>
                <el-table-column prop="txName" label="题型" width="150">
                </el-table-column>
                <el-table-column prop="score" label="分数" width="63">
                </el-table-column>
                <el-table-column label="难度" width="63">
                    <template slot-scope="scope">
                        <span v-html="scope.row.nanduStar"></span>
                    </template>
                </el-table-column>
                <el-table-column prop="createdDate" label="创建时间"
                                 width="150">
                </el-table-column>
                <el-table-column width="100" align="right">
                    <template slot-scope="scope">
                        <el-dropdown :show-timeout="0" placement="left">
                            <el-button icon="el-icon-arrow-left" size="mini" v-on:click.stop="return false">
                                操作
                            </el-button>
                            <el-dropdown-menu slot="dropdown">
                                <el-dropdown-item icon="el-icon-edit" v-on:click.native="handleCommand('edit',scope.row)">修改</el-dropdown-item>
                                <el-dropdown-item icon="el-icon-delete" v-on:click.native="handleCommand('delete',scope.row)" style="color:red;" divided>删除</el-dropdown-item>
                            </el-dropdown-menu>
                        </el-dropdown>
                    </template>
                </el-table-column>
                @await Html.PartialAsync("_PartialTableEmpty")
            </el-table>

            <div style="text-align: center; margin-top: 10px;">
                <el-pagination v-on:current-change="handleCurrentChange" background
                               :current-page="formInline.pageIndex"
                               v-on:size-change="handleSizeChange"
                               :page-size="formInline.pageSize"
                               :page-sizes="pageSizes"
                               layout="total,sizes, prev, pager, next, jumper"
                               :total="tmTotal">
                </el-pagination>
            </div>
        </el-card>
    </el-col>
</el-row>

@section Scripts{
    <script src="/sitefiles/assets/js/admin/exam/examTm.js" type="text/javascript"></script>
}